package com.lancoo.cvas.mapper;

import com.lancoo.cvas.config.MybatisRedisCache;
import com.lancoo.cvas.entity.RuleUsable;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.lancoo.cvas.pojo.dto.BasicRule;
import org.apache.ibatis.annotations.CacheNamespace;
import org.apache.ibatis.annotations.Param;

import java.util.List;

/**
 * 基础规则
 * 
 * @author liufeng
 * @email 1037383243@qq.com
 * @date 2023-12-04 11:54:01
 */
@CacheNamespace(implementation = MybatisRedisCache.class, eviction = MybatisRedisCache.class)
public interface RuleUsableMapper extends BaseMapper<RuleUsable> {

    int addBatch(List<RuleUsable> usableList);

    void setBasicRule(@Param("rules") List<BasicRule> rules, @Param("taskId") Integer taskId);

    /**
     * 根据学校id和学期获取课时方案
     * @param schoolId
     * @param term
     * @return
     */
    List<RuleUsable> getBySchoolTerm(@Param("schoolId") String schoolId,@Param("term") String term);

    List<RuleUsable> getByTaskId(Integer taskId);

    RuleUsable getByCode(Integer taskId, int code);
}
